package com.example.cheeseerpadmin.sys.service.impl;

import com.example.cheeseerpadmin.sys.entity.SysPermission;
import com.example.cheeseerpadmin.sys.mapper.SysPermissionMapper;
import com.example.cheeseerpadmin.sys.service.SysPermissionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author cheese
 * @since 2022-01-19
 */
@Service
@Transactional
public class SysPermissionServiceImpl extends ServiceImpl<SysPermissionMapper, SysPermission> implements SysPermissionService {
    @Override
    public boolean removeById(Serializable id) {
        SysPermissionMapper permissionMapper = this.getBaseMapper();
        //根据权限得到的id去删除对应的权限和各个角色之间的关系
        permissionMapper.deleteRolePermissionByPid(id);
        return super.removeById(id);//删除权限表的数据
    }

}
